import VueRouter from 'vue-router'
import Tab1 from "@/pages/Tab1";
import Tab2 from "@/pages/Tab2";
import Tab3 from "@/pages/Tab3";
import Tab4 from "@/pages/Tab4";




const vueRouter =  new VueRouter({
    mode:'history',
    routes:[
        {
            path:'/Tab1',
            component:Tab1
        },
        {
            path:'/Tab2',
            component:Tab2
        },
        {
            path:'/Tab3',
            component:Tab3
        },
        {
            path:'/Tab4',
            component:Tab4
        }
    ]
})

//全局前置路由守备
//参数:: to:目标route,from:来自route,next()放行函数操作
vueRouter.beforeEach((to,from,next)=>{
    console.log(to,from);
    next();
})

//全局后置路由守备
//参数 :: to:目标route,from:来自route
vueRouter.afterEach((to)=>{
    document.title = to.path;
})

//暴露router
export default vueRouter
